package day0722API;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class Test1 {
    public static void main(String[] args) {
        int[]   a={33, 11, 6, 201,0};
        //调用Arrays工具类中的sort方法对数组排序(升序)
        Arrays.sort(a);
        System.out.println(Arrays.toString(a));

        String[]   b={"ca","a","bb", "aa","aaa", "ab" };
        //调用Arrays工具类中的sort方法对数组排序(升序)
        Arrays.sort(b);
        System.out.println(Arrays.toString(b));
        //Arrays.sort对字符串会采用自然排序


        ArrayList<Integer> list=new ArrayList<Integer>();
        list.add(10);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(0);
        //集合排序
        Collections.sort(list);
        System.out.println(list);



//"ca","a","bb", "aa","aaa", "ab"
        ArrayList<String> list2=new ArrayList<>();
        list2.add("ca");
        list2.add("a");
        list2.add("bb");
        list2.add("aa");
        list2.add("aaa");
        list2.add("ab");
        //集合排序
        Collections.sort(list2);
        System.out.println(list2);


    }
}
